fix: declare Hive partitioned scans as Range - #25279
gstamatakis95 wants to merge 3 commits into
Conversation
|
Thanks for opening this! I'll try to review soon. One quick reference without having reviewed (sorry!): it's possible that there is some code reuse possible across the various TableProviders: see #22395 (comment) |
| /// Builds output partitioning over `partition_cols` (resolved to their indices in | ||
| /// `schema`) with `partition_count` partitions. Returns `None` when there are no | ||
| /// partition columns. Callers use this to declare the output partitioning of a scan | ||
| /// whose file groups are organized by partition column values. | ||
| pub fn output_partitioning_from_partition_fields( | ||
| schema: &Schema, | ||
| partition_cols: &Fields, | ||
| partition_count: usize, | ||
| ) -> Option<Partitioning> { |
There was a problem hiding this comment.
This still returns Partioning::Hash by default, which means external consumers might still get the old behavior.
Should it be deprecated and replaced with a new function/method like?:
pub fn output_range_partitioning_from_split_points(
schema: &Schema,
partition_cols: &Fields,
split_points: Vec<SplitPoint>,
) -> Result<Option<Partitioning>>;...which could then be used in ListingTable::scan as well?
There was a problem hiding this comment.
Deprecated it in favor of output_range_partitioning_from_split_points with the signature you suggested and ListingTable::scan now uses it.
| let ordering = table_partition_cols | ||
| .iter() | ||
| .map(|field| { | ||
| Expr::Column(Column::from_name(field.name())).sort(true, true) |
There was a problem hiding this comment.
If these bools are meant to correspond to SortOptions::default(), maybe they should be derived from it instead.
There was a problem hiding this comment.
The ordering now comes from PhysicalSortExpr::new_default, which is SortOptions::default(), the same default used to cut the groups.
Which issue does this PR close?
Rationale for this change
What changes are included in this PR?
What is the testing strategy for this PR?
Are there any user-facing changes?